// 验证二叉搜索树

package Leetcode;

class solution_098 {
    public boolean isValidBST(TreeNode root) {
        return judge(root, Long.MIN_VALUE, Long.MAX_VALUE);
    }

    public boolean judge(TreeNode root, long low, long high) {
        if (root == null)
            return true;
        if (root.val <= low || root.val >= high)
            return false;
        return judge(root.left, low, root.val) && judge(root.right, root.val, high);
    }
}

public class Solution098 {

}
